package com.ssmk.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * 用途：
 * author：王倩凤Administrator
 * date:2017/9/10.
 */

public class WelcomeAdapter extends PagerAdapter{
    private final List<View> mList;

    public WelcomeAdapter(List<View> list){
        this.mList = list;
    }
    @Override
    public int getCount() {
        return mList.size()>0 ? mList.size():0;
    }

    @Override
    public boolean isViewFromObject(View view, Object o) {
        return view == o;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(mList.get(position));
        return mList.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(mList.get(position));
    }
}
